<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script type="text/javascript">
    function bookBorrowDeleteOrActive(id) {
        if(confirm("您确定要删除这个信息吗？")) {
            window.location="bookBorrowServlet.action?action=delete&bookId="+id;
        }
    }
    //选中左侧菜单栏
    $(document).ready(function(){
        $("#bookBorrow").addClass("active");
    });
</script>
<div class="data_list">
    <div class="data_list_title">
        图书借阅管理
    </div>
    <form name="myForm" class="form-search" method="post" action="dormBuild.action?action=list">
        <button class="btn btn-success" type="button" style="margin-right: 50px;" onclick="javascript:window.location='bookBorrowServlet.action?action=add'">添加</button>
        <span class="data_search">
            <select id="id" name="id" style="width: 120px;">
                <option value="">全部借阅信息</option>
                <option value=""></option>
            </select>
            &nbsp;<button type="submit" class="btn btn-info" onkeydown="if(event.keyCode==13) myForm.submit()">搜索</button>
        </span>
    </form>
    <div>
        <table class="table table-striped table-bordered table-hover datatable">
            <thead>
            <tr>
                <th width="15%">序号</th>
                <th>图书编号</th>
                <th>图书名称</th>
                <th>借阅时间</th>
                <th>归还时间</th>
                <th width="20%">操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${requestScope.bookBorrows}" var="bookBorrow" varStatus="status">
                <tr>
                    <td>${status.count}</td>
                    <td>${bookBorrow.bookId}</td>
                    <td>${bookBorrow.bookName}</td>
                    <td>${bookBorrow.borrowTime}</td>
                    <td>${bookBorrow.returnTime}</td>
                    <td>
                        <button class="btn btn-mini btn-info" type="button" onclick="javascript:window.location='bookBorrowServlet.action?action=update&bookId=${bookBorrow.bookId}'">修改</button>&nbsp;
                        <button class="btn btn-mini btn-danger" type="button" onclick="bookBorrowDeleteOrActive(${bookBorrow.bookId})">删除</button>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
    <div align="center"><font color="red"></font></div>
</div>
